class CreateSalesPayments < ActiveRecord::Migration[5.1]
  def change
    create_table :sales_payments do |t|
      t.integer :order_id, comment: '相关订单'
      t.integer :firm_id, comment: '相关公司'
      t.integer :created_by, comment: '操作人'
      t.integer :payment_type, comment: '付款方式'
      t.float :total_money, comment: '订单总金额'
      t.float :paid_money, comment: '付款金额'
      t.string :notes, comment: '备注'

      t.timestamps
    end
    add_index :sales_payments, :order_id
    add_index :sales_payments, :firm_id
    add_index :sales_payments, :payment_type
    add_index :sales_payments, :created_by
  end
end
